<%@page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack"%>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html:html>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<%
    String pageSource = "";
    if( request.getParameter( "origin" ) != null )
    {
        pageSource = request.getParameter( "origin" );
    }
%>

<META http-equiv='Content-Type' content='text/html; charset=windows-1252'>
<LINK href='<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css' type='text/css' rel='stylesheet'>
<!-- added by raju on 17th March 2004 -->

<SCRIPT LANGUAGE="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
    function submit()
    {
        var pa = document.getElementById("errors");
            pa.innerHTML = "";
        var errors = '';

        var requistionDate      =   document.purchaseOrderForm['purchaseOrder.requistionDate'].value;
        var requiredDate        =   document.purchaseOrderForm['purchaseOrder.requiredDate'].value;
        var promisedDate        =   document.purchaseOrderForm['purchaseOrder.promisedDate'].value;
        var promisedShipDate    =   document.purchaseOrderForm['purchaseOrder.promisedShipDate'].value;;

        if( !chkDate( requistionDate.trim (), "Requistion Date" , "N" ) )
        {
            errors = errors + '<br>' + errMsg;
            document.purchaseOrderForm['purchaseOrder.requistionDate'].focus();
            document.purchaseOrderForm['purchaseOrder.requistionDate'].select();
        }

        if( !chkDate( requiredDate.trim (), "Required Date" , "N" ) )
        {
            errors = errors + '<br>' + errMsg;
            document.purchaseOrderForm['purchaseOrder.requiredDate'].focus();
            document.purchaseOrderForm['purchaseOrder.requiredDate'].select();
        }
        if( !chkDate( promisedDate.trim (), "Promised Date" , "N" ) )
        {
            errors = errors + '<br>' + errMsg;
            document.purchaseOrderForm['purchaseOrder.promisedDate'].focus();
            document.purchaseOrderForm['purchaseOrder.promisedDate'].select();
        }
        if( !chkDate( promisedShipDate.trim (), "Promised Ship Date" , "N" ) )
        {
            errors = errors + '<br>' + errMsg;
            document.purchaseOrderForm['purchaseOrder.promisedShipDate'].focus();
            document.purchaseOrderForm['purchaseOrder.promisedShipDate'].select();
        }
	    if(errors != '')
        {
            pa.innerHTML = errors;
            return;
        }
          document.purchaseOrderForm.action = "<%=chipTracContext%>/purchaseOrder.do?action=savePurchaseOrderDateEntry";
          document.purchaseOrderForm.submit();
    }

    function cancel()
    {
        window.close();
    }

    //added phani 29/04/04

    function enableOrDisable()
    {
        var hold = document.purchaseOrderForm['purchaseOrder.poHold'].value;
        if ( document.purchaseOrderForm['purchaseOrder.poHold'].value == "true" )
        {
            document.purchaseOrderForm['purchaseOrder.requistionDate'].disabled = true;
            document.purchaseOrderForm['purchaseOrder.requiredDate'].disabled = true;
            document.purchaseOrderForm['purchaseOrder.promisedDate'].disabled = true;
            document.purchaseOrderForm['purchaseOrder.promisedShipDate'].disabled = true;
        }
        else
        {
            document.purchaseOrderForm['purchaseOrder.requistionDate'].disabled = false;
            document.purchaseOrderForm['purchaseOrder.requiredDate'].disabled = false;
            document.purchaseOrderForm['purchaseOrder.promisedDate'].disabled = false;
            document.purchaseOrderForm['purchaseOrder.promisedShipDate'].disabled = false;

        }
    }

</SCRIPT>
</HEAD>

<BODY bgColor='#ffffff' leftMargin='0' topMargin='0' marginheight='0' marginwidth='0' onload="javascript:enableOrDisable();">

<!-- Top Header Start-->
	<!--%@include file="/jsp/includes/header.jsp"  %>
<!-- Top Header End-->

<p>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
	<!--%@include file="/jsp/finance/finance_setup_menu.jsp" %>
<!-- end of the side navigations -->

</TD>
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>

<!-- from here your body starts -->
<html:form name="purchaseOrderForm" action="/purchaseOrder.do" method="post" type="com.scalar.chiptrack.finance.purchaseorder.forms.PurchaseOrderForm">
			<P>
			<TABLE BORDER="0" WIDTH="100%" HEIGHT="139">
				<TR>
					<TD WIDTH="100%" HEIGHT="36">
						<TABLE BORDER="0" WIDTH="100%">
							<TR>
								<TD WIDTH="100%" ALIGN="CENTER" class="NArialW">
									<P ALIGN="CENTER">Purchasing Date Entry
								</TD>
							</TR>
							<TR>
                                <TD><chiptrack:info styleClass="NArialL" /></TD>
                            </TR>
			            	<TR>
                                <TD><chiptrack:errors styleClass="NArialL" /></TD>
          	            	</TR>
				            <TR>
                                <TD><chiptrack:moreErrorInfo styleClass="NArialL" /></TD>
                            </TR>
							<TR class='NArialL'>
								<TD colspan=2 align="left">
									<FONT id="errors" color="red"></FONT>
								</TD>
							</TR>
							<TR>
								<TD colspan=2 >&nbsp;	</TD>
							</TR>
						</TABLE>
					</TD>
				</TR>
				<TR>
					<TD WIDTH="100%">
                    <nested:nest property="purchaseOrder">
						<TABLE BORDER="0" WIDTH="100%">
							<TR class="NArialL">
								<TD WIDTH="5%">&nbsp;</TD>
								<TD WIDTH="22%">Requistion Date:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="14%"><nested:text property="requistionDate" styleClass="txfield" size="15" /></TD>
								<TD WIDTH="10%">&nbsp;</TD>
								<TD WIDTH="23%">Purchase Order Date:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="18%"><nested:text property="purchaseOrderDate" styleClass="txfield" size="15" disabled="true" /></TD>
								<TD WIDTH="5%">&nbsp;</TD>
							</TR>
							<TR class="NArialL">
								<TD WIDTH="5%">&nbsp;</TD>
								<TD WIDTH="22%">Required Date:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="14%"><nested:text property="requiredDate" styleClass="txfield" size="15" /></TD>
								<TD WIDTH="10%">&nbsp;</TD>
								<TD WIDTH="18%">Last Edited Date:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="23%"><nested:text property="lastEditedDate" styleClass="txfield" size="15" disabled="true" /></TD>
								<TD WIDTH="5%">&nbsp;</TD>
							</TR>
							<TR class="NArialL">
								<TD WIDTH="5%">&nbsp;</TD>
								<TD WIDTH="22%">Promised Date:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="14%"><nested:text property="promisedDate" styleClass="txfield" size="15" /></TD>
								<TD WIDTH="10%">&nbsp;</TD>
								<TD WIDTH="18%">Last Printed Date:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="23%"><nested:text property="lastPrintedDate" styleClass="txfield" size="15" disabled="true" /></TD>
								<TD WIDTH="5%">&nbsp;</TD>
							</TR>
                            <TR class="NArialL">
								<TD WIDTH="5%">&nbsp;</TD>
								<TD WIDTH="22%">Promised Ship Date:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="14%"><nested:text property="promisedShipDate" styleClass="txfield" size="15" /></TD>
								<TD WIDTH="10%">&nbsp;</TD>
								<TD WIDTH="18%">&nbsp;</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="23%">&nbsp;</TD>
								<TD WIDTH="5%">&nbsp;</TD>
							</TR>
                            <TR><TD colspan="9">&nbsp;</TD></TR>
                            <TR class="NArialL">
								<TD WIDTH="5%">&nbsp;</TD>
								<TD WIDTH="22%">Date Place On Hold:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="14%"><nested:text property="datePlaceOnHold" styleClass="txfield" size="15" disabled="true"/></TD>
								<TD WIDTH="10%">&nbsp;</TD>
								<TD WIDTH="18%">Place On Hold By:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="23%"><nested:text property="placeOnHoldBy" styleClass="txfield" size="15" disabled="true"/></TD>
								<TD WIDTH="5%">&nbsp;</TD>
							</TR>
                            <TR class="NArialL">
								<TD WIDTH="5%">&nbsp;</TD>
								<TD WIDTH="22%">Date Hold Removed:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="14%"><nested:text property="dateHoldRemoved" styleClass="txfield" size="15" disabled="true" /></TD>
								<TD WIDTH="10%">&nbsp;</TD>
								<TD WIDTH="18%">Hold Removed By:</TD>
								<TD WIDTH="1%">&nbsp;</TD>
								<TD WIDTH="23%"><nested:text property="holdRemovedBy" styleClass="txfield" size="15" disabled="true" /></TD>
								<TD WIDTH="5%">&nbsp;</TD>
							</TR>
	                        <TR>
								<TD colspan="9">&nbsp;</TD>
							</TR> <nested:hidden property="poHold"/>
                </nested:nest>
						</TABLE>
					</TD>
				</TR>
				<TR>
					<TD WIDTH="100%">
						<TABLE BORDER="0" WIDTH="100%">
							<TR><TD colspan="4">&nbsp;</TD></TR>
							<TR>
								<TD WIDTH="40%">&nbsp;</TD>
								<TD WIDTH="10%" align="center">
                                    <% if( pageSource.equalsIgnoreCase("view") )
                                    {
                                    %>
									<IMG SRC="<%=chipTracContext%>/jsp/includes/images/save.gif" ALIGN="BOTTOM" BORDER="0">
                                    <%}
                                    else
                                    {
                                    %>
									<A href="javascript:submit()" onmouseover="window.status='Click here to Save Purchasing Date Details';return true" onmouseout="window.status='';return true"><IMG SRC="<%=chipTracContext%>/jsp/includes/images/save.gif" ALIGN="BOTTOM" BORDER="0"></A>
                                    <%
                                    }
                                    %>
								</TD>
								<TD WIDTH="10%">
									<A href="javascript:cancel()" onmouseover="window.status='Click here to Close this window';return true" onmouseout="window.status='';return true">
									<IMG SRC="<%=chipTracContext%>/jsp/includes/images/cancel.gif" ALIGN="BOTTOM" BORDER="0"></A>
								</TD>
								<TD WIDTH="40%">&nbsp;</TD>
							</TR>
							<TR><TD colspan="4">&nbsp;</TD></TR>
						</TABLE>
					</TD>
				</TR>
			</TABLE>
            </html:form>
<!-- Your body ends here -->
		</TD>
		<TD BGCOLOR="white"><IMG SRC="images/spacer.gif" WIDTH="1" HEIGHT="1" ALIGN="BOTTOM" BORDER="0"></TD>
	</TR>
</TBODY></TABLE>

<!-- Footer starts here -->
	<!--%@include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->

</BODY>
</html:html>